import { defineStore } from "pinia";

const loginInfo = JSON.parse(sessionStorage.getItem('loginInfo') || '{}');

console.log('@登录信息:', loginInfo);

// 真正存储数据的地方
export const useUserStore = defineStore("user", {
  state: () => ({
    token: "",
    loginUser: {
        username: loginInfo.username || "",
        email: loginInfo.email || "",
    },
  }),

//   actions: {
//     setToken(token) {
//       this.token = token;
//     },
//     setLoginUser(loginUser) {
//       this.loginUser = loginUser;
//     },
//   },
});

export default useUserStore;